<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="box" id = "box"></div>

    <script>
        var box = document.getElementById('box')

        // //通过设置属性节点内容操作样式
        // box.setAttribute('style','width:100px;'+'height:100px;'+'background-color:crimson;')

        // //通过给元素的属性赋值操作样式
        // box.style.width = '300px';
        // box.style.height = '300px';
        // box.style.backgroundColor = 'aqua';

        //直接设置完整css样式
        box.style.cssText = 'width:100px;'+'height:100px;'+'background-color:crimson;'
    </script>
</body>
</html>